import javax.swing.text.TabableView;
import java.util.HashMap;

/**
 * @description:
 * @author: Code-zyc
 * @date: Created in 2022/4/23 9:27
 * @version: 1.0
 * @modified By:
 */
public class Test {
    public static void main(String[] args) {
//        System.out.println(222&15);
        HashMap<String,Integer> hashMap=new HashMap(24);
        hashMap.put(null, 1);
//        System.out.println("cap=15:获取到的值"+tableSizeFor(15));
//        System.out.println("cap=3:获取到的值"+tableSizeFor(3));
//        System.out.println("cap=16:获取到的值"+tableSizeFor(16));
//        System.out.println("cap=24:获取到的值"+tableSizeFor(24));
//        System.out.println("cap=1:获取到的值"+tableSizeFor(1));
    }

   public static int tableSizeFor(int cap) {
        int n = cap - 1;
        n |= n >>> 1;
        n |= n >>> 2;
        n |= n >>> 4;
        n |= n >>> 8;
        n |= n >>> 16;
        return n;
    }
}
